# Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
from waflib import Logs

def build(bld):
	# Oculus can only be built using VS 2015.
	# This is a limitation of the Oculus code.
	build_oculus = ('MSVC_VERSION' in bld.env and bld.env['MSVC_VERSION'] == '14.0')
	parse_oculus = ('build' not in bld.cmd)

	if build_oculus or parse_oculus:
		bld.CryEngineStaticModule( 
			target    = 'oculus', 
			vs_filter = 'Libs',
			file_list = 'oculus.waf_files',
			exclude_from_static_code_analyzer = True,

			win_cxxflags = [ '/EHsc', '/W0', '/Wv:18' ],
			win_cflags = [ '/W0', '/Wv:18' ],
			win_includes    = [
				Path('Code/SDKs/OculusSDK/LibOVR/Include'),
				Path('Code/SDKs/OculusSDK/LibOVRKernel/Src'),
				],

			module_provides = dict(
				includes = [ Path('Code/SDKs/OculusSDK/LibOVR/Include'), ],
				defines = [ 'INCLUDE_OCULUS_SDK' ],
				win_lib = ['oleaut32'],
			),
		)
	else:
		Logs.warn('MSVC 14.0 is not being used - oculus cannot be built.')
		
